package org.yagnus.stats.summary.univariate;

public class Max<O extends Comparable<O>> extends
		UnivariateWeightedSummaryStatistic<O> {

	O max = null;

	@Override
	public O get() {
		if (max == null)
			return null;
		else
			return max;
	}

	@Override
	public void clear() {
		max = null;
	}

	@Override
	public void add(O data, double weight) {
		if (max == null) {
			max = data;
		} else if (data != null) {
			if (max.compareTo(data) < 0) {
				max = data;
			}
		}

	}

}
